#ifndef REQUIREMENT_MANAGEMENT_WIDGET_H
#define REQUIREMENT_MANAGEMENT_WIDGET_H

#include <QWidget>
#include <QMenu>
#include <QTreeWidgetItem>

namespace Ui {
class RequirementManagementWidget;
}

class RequirementManagementWidget : public QWidget
{
    Q_OBJECT

public:
    explicit RequirementManagementWidget(QWidget *parent = nullptr);
    ~RequirementManagementWidget();
    void setPrjUuid(QString uuid);

private:
    void initUi();
    void initEvents();
    void initMenu();
    void initRequirementData();
    bool updateRequirement(QString uuid,
                           QString parentRequirementUuid,
                           QString requirementName,
                           QString requirementDescription,
                           QString lastModifyTime,
                           QString requirementStatus);
    bool deleteRequirement(QString uuid);
    bool deleteChildRequirement(QString parentUuid);
    void deleteTreeWidgetItem(QTreeWidgetItem *item);

private slots:
    void onNewRequirementBtnClicked();
    void onNewChildRequirementActionTriggered();
    void onEditRequirementActionTriggered();
    void onDeleteRequirementActionTriggered();
    void onDeleteChildRequirementActionTriggered();

private:
    Ui::RequirementManagementWidget *ui;
    QString                          m_prjUuid;
    QMenu                           *m_treeWidgetMenu;
    QTreeWidgetItem                 *m_currentMenuAtItem;
};

#endif // REQUIREMENT_MANAGEMENT_WIDGET_H
